package com.sweet.entity;

import com.sweet.service.IdUtils;
import io.vertx.core.json.JsonObject;

public class User implements JsonEntity{

  private String id;

  private String phone;

  private String password;

  private String name;

  public User() {
  }

  public User(String phone, String password, String name) {
    this.id = IdUtils.get().nextId()+"";
    this.phone = phone;
    this.password = password;
    this.name = name;
  }

  public String getId() {
    return id;
  }

  public void setId(String id) {
    this.id = id;
  }

  public String getPhone() {
    return phone;
  }

  public void setPhone(String phone) {
    this.phone = phone;
  }

  public String getPassword() {
    return password;
  }

  public void setPassword(String password) {
    this.password = password;
  }

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  @Override
  public String toString() {
    return "User{" +
            "id='" + id + '\'' +
            ", phone='" + phone + '\'' +
            ", password='" + password + '\'' +
            ", name='" + name + '\'' +
            '}';
  }

  @Override
  public JsonObject toJson() {
    return new JsonObject()
            .put("id", id)
            .put("name", name)
            .put("password", password)
            .put("phone", phone);

  }
}
